package praktikumid.p07_k;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		//
		
		// for player in players:
		//   for unit in player.units
		//     unit.walk()

		// for unit in units:
		//   unit.walk();
		
		HumanUnit h = new HumanUnit("Ants", 100);
		h.walk();
		h.setLastname("po");
		h.printOut();
	
		
		WizardUnit w = new WizardUnit();
		w.spells = new String[10];
		w.spells[0] = "magic spell 1";
		w.spells[1] = "gigantic hyper spell";
		w.name = "Merlin";
		w.walkingSpeed = 10;
		w.walk();
		w.printOut();
		
		
		Unit u = new WizardUnit();
		u = new HumanUnit("tere", 1);
		
		Unit[] units = new Unit[10];
		units[0] = h;
		units[1] = w;
		units[2] = new HumanUnit("Malle", 2);
		
		for (int i = 0; i < 3; i++) {
			units[i].walk();
		}
		
		ArrayList<Unit> units2 = new ArrayList<Unit>();
		units2.add(h);
		units2.add(w);
		units2.add(new HumanUnit("Kalle", 5));
		for (Unit u2 : units2) {
			if (u2 instanceof HumanUnit) {
				System.out.println("on human, 2br!2b");
				//HumanUnit tmp = (HumanUnit) u2;
				//tmp.toBeOrNotToBe();
				((HumanUnit) u2).toBeOrNotToBe();
			}
			u2.walk();
			u2.printOut();
		}
		
		/*
		try {
			BufferedReader br = new BufferedReader(new FileReader("ba"));
			Reader r = new BufferedReader(new FileReader("ba"));
			
			br.readLine();
			BufferedReader br2 = (BufferedReader) r;
			br2.readLine();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		*/
	}

}
